package strategy.myself;


import strategy.myself.payPort.Pay;
import strategy.myself.payPort.StrategyContenx;

public class Order {
    private String uid;
    private String orderId;
    private double amount;

    public Order(String uid, String orderId, double amount) {
        this.uid = uid;
        this.orderId = orderId;
        this.amount = amount;
    }

    public MsgResult pay(){
        return  pay(StrategyContenx.DEFAULT_PAY);
    }

    public MsgResult pay(String payKey){
           //获取支付方式
           Pay pay=StrategyContenx.getPay(payKey);
           System.out.println("欢迎使用"+pay.getName());
           System.out.println("本次使用金额"+amount);
           return pay.pay(uid,amount);
    }
}
